package com.duapk.index.bean;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.lucene.document.Field;

/**
 * 索引字段信息
 * 
 * @Package: com.duapk.index.bean
 * @ClassName: FieldInfo
 * @author: jiangzheng
 * @date: Apr 5, 2011 4:54:17 PM
 * 
 */
public class FieldInfo {

	/**
	 * 字段名称
	 */
	private String name;

	/**
	 * 索引标识
	 */
	private Field.Index index;

	/**
	 * 存储标识
	 */
	private Field.Store store;

	/**
	 * 最小词数
	 */
	private int minTerms;

	/**
	 * 最大词数
	 */
	private int maxTerms;

	/**
	 * 字段权重
	 */
	private float boost;

	/**
	 * 字段类型
	 */
	private String type;

	/**
	 * 是否忽略词频及词的位置信息
	 */
	private boolean omitTermFreqAndPositions;

	/**
	 * NumericField类的一个属性值
	 */
	private int precisionStep;

	public FieldInfo(String name) {
		this.name = name;
	}

	public FieldInfo() {

	}

	public boolean isOmitTermFreqAndPositions() {
		return omitTermFreqAndPositions;
	}

	public void setOmitTermFreqAndPositions(boolean omitTermFreqAndPositions) {
		this.omitTermFreqAndPositions = omitTermFreqAndPositions;
	}

	public Field.Index getIndex() {
		return index;
	}

	public void setIndex(Field.Index index) {
		this.index = index;
	}

	public Field.Store getStore() {
		return store;
	}

	public void setStore(Field.Store store) {
		this.store = store;
	}

	public int getMinTerms() {
		return minTerms;
	}

	public void setMinTerms(int minTerms) {
		this.minTerms = minTerms;
	}

	public int getMaxTerms() {
		return maxTerms;
	}

	public void setMaxTerms(int maxTerms) {
		this.maxTerms = maxTerms;
	}

	public float getBoost() {
		return boost;
	}

	public void setBoost(float boost) {
		this.boost = boost;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this);
	}

	public int getPrecisionStep() {
		return precisionStep;
	}

	public void setPrecisionStep(int precisionStep) {
		if (precisionStep == -1) {
			precisionStep = Integer.MAX_VALUE;
		}
		this.precisionStep = precisionStep;
	}
}
